<?php
//手机号注册路由
Route::get('register','Home\RegisterController@index');
//发送手机验证码
Route::get('sendcode','Home\RegisterController@sendcode');
//执行注册
Route::post('dophoneregister','Home\RegisterController@dophoneregister');

//前台首页路由
Route::get('index','Home\IndexController@index');
Route::get('lists/{id}','Home\IndexController@lists');
Route::get('detail/{id}','Home\IndexController@detail');

Route::post('collect','Home\IndexController@collect');



//邮箱注册激活路由
Route::get('emailregister','Home\RegisterController@emailregister');
Route::post('doregister','Home\RegisterController@doregister');


Route::group(['prefix'=>'admin','namespace'=>'Admin'],function (){
    //后台登录路由
    Route::get('login','LoginController@login');
    //验证码
    Route::get('code','LoginController@code');
    //执行登录的路由
    Route::post('dologin','LoginController@doLogin');
    //加密路由
    Route::get('encryption','LoginController@encryption');
    //退出登录
    Route::get('loginout','LoginController@loginout');
});

//没有权限时的路由
Route::get('noaccess','Admin\LoginController@noaccess');


//Route::group(['prefix'=>'admin','namespace'=>'Admin','middleware'=>['HasPermission','IsLogin']],function (){
Route::group(['prefix'=>'admin','namespace'=>'Admin','middleware'=>['IsLogin']],function (){
    //后台首页
    Route::get('index','LoginController@index');
    //后台欢迎页
    Route::get('welcome','LoginController@welcome');

    //后台用户模块相关路由
    //用户多删除
    Route::post("user/del","UserController@delAll");
    //用户赋予角色的方法
    Route::get('user/actor/{id}','UserController@actor');
    //处理用户赋予角色的方法
    Route::post('user/doactor','UserController@doactor');
    Route::resource("user","UserController");

    //角色模块相关路由
    //角色多删除
    Route::post("role/roledel","RoleController@delAll");
    //角色授权路由
    Route::get('role/auth/{id}','RoleController@auth');
    //处理角色授权的方法
    Route::post('role/doauth','RoleController@doauth');
    Route::resource("role","RoleController");

    //权限模块相关路由
    Route::resource("permission","PermissionController");
    //权限多删除
    Route::post("permission/permissiondel","PermissionController@delAll");

    //分类相关的路由
    Route::resource("cate","CateController");
    //修改排序的路由
    Route::post("cate/changeorder","CateController@changeOrder");
    //分类多删除
    Route::post("cate/catedel","CateController@delAll");

    //文章相关路由
    Route::resource("article","ArticleController");
    //上传路由
    Route::post("article/upload","ArticleController@upload");
    //将markdown内容转换为Html内容的路由
    Route::post("article/pre_markdown","ArticleController@pre_markdown");
    //文章多删除
    Route::post("article/articledel","ArticleController@delAll");

    //网站配置模块相关路由
    Route::post("config/changecontent","ConfigController@changeContent");
    Route::get("config/putcontent","ConfigController@putContent");
    Route::resource("config","ConfigController");

});